package top.szhome.system.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.szhome.framework.starter.db.support.SimpleServiceImpl;
import top.szhome.system.convert.DictValueConverter;
import top.szhome.system.dto.DictValueDTO;
import top.szhome.system.entity.DictValue;
import top.szhome.system.mapper.DictValueMapper;
import top.szhome.system.service.DictValueService;
import top.szhome.system.vo.DictValueVO;

import java.util.List;

/**
 * 字典项 服务实现
 *
 * @author 唐加利
 * @date 2023/08/02
 **/
@AllArgsConstructor
@Service
@Slf4j
public class DictValueServiceImpl extends SimpleServiceImpl<DictValueMapper, DictValueConverter, DictValueDTO, DictValue, DictValueVO> implements DictValueService {

    @Override
    public List<DictValueVO> getValues(String dictCode) {
        List<DictValue> values = list(Wrappers.lambdaQuery(DictValue.class).eq(DictValue::getDictCode, dictCode));
        return getBaseConvert().to(values);
    }

}
